package com.ailk.cuc.autotestbg.common.business.report;

import java.awt.Color;
import java.io.File;
import java.io.FileOutputStream;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ailk.cuc.autotestbg.common.bean.AutoCaseResultBGBean;
import com.ailk.cuc.autotestbg.common.bean.AutoPlanResultBGBean;
import com.ailk.cuc.autotestbg.common.bean.AutoStepResultBGBean;
import com.ailk.cuc.autotestbg.common.bean.AutoStepResultDetailBGBean;
import com.ailk.cuc.autotestbg.common.bean.AutoTestPlanBean;
import com.ailk.cuc.autotestbg.common.bean.AutoTestReportBGBean;
import com.ailk.cuc.autotestbg.common.constants.StaticParam;
import com.ailk.cuc.autotestbg.common.utils.MailUtils;
import com.ailk.cuc.autotestbg.common.utils.SpringContextUtil;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.lowagie.text.Cell;
import com.lowagie.text.Chapter;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Section;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.draw.LineSeparator;

public class BusinessReport {
	
	private static Log logger = LogFactory.getLog(BusinessReport.class);
		
	private Document document;
	private PdfWriter pdfWri;
	private BaseFont bfChinese;
	private AutoPlanResultBGBean planResultBean;
	private String imgDir;
	
	@SuppressWarnings("unchecked")
	public void createReport(AutoTestPlanBean testPlanBean) throws Exception{
		logger.info("taskId:"+testPlanBean.getTaskId()+"开始生成测试报告");
		SqlMapClient sqlMapClient = (SqlMapClient)SpringContextUtil.getBean("sqlMapClient");
		AutoPlanResultBGBean resultBean = new AutoPlanResultBGBean();
		resultBean.setTaskId(testPlanBean.getTaskId());
		ArrayList<AutoPlanResultBGBean> planResultList = (ArrayList)sqlMapClient.queryForList("common_report.getPlanResultBGBean",resultBean);
					
		String detailName = "TaskId_"+testPlanBean.getTaskId()+StaticParam.reportNameAdd+"_"+testPlanBean.getPlanName()+"_明细.pdf";
		String collectName = "TaskId_"+testPlanBean.getTaskId()+StaticParam.reportNameAdd+"_"+testPlanBean.getPlanName()+"_总体.pdf";
			
		AutoTestReportBGBean reportBean = new AutoTestReportBGBean();
		reportBean.setTaskId(testPlanBean.getTaskId());
		reportBean.setTestPlanId(testPlanBean.getPlanId());
		reportBean.setTestPlanName(testPlanBean.getPlanName());
		reportBean.setReport(collectName);
		reportBean.setDetailReport(detailName);
			
		if(planResultList == null) {
			logger.error("测试计划结果为空,无法生成测试报告");
			reportBean.setErrorMsg("测试计划结果为空,无法生成测试报告");
			sqlMapClient.insert("common_report.insertReportBGBean",reportBean);
			return;
		}else {
			if (planResultList.size()==1) {			
				logger.info("开始生成测试报告:" + detailName);
				
				AutoCaseResultBGBean caseResultBean1 = new AutoCaseResultBGBean();
				caseResultBean1.setTaskId(testPlanBean.getTaskId());
				ArrayList<AutoCaseResultBGBean> csseResultList = (ArrayList)sqlMapClient.queryForList("common_report.getCaseResultBGBeanByTaskId",caseResultBean1);
				
				AutoPlanResultBGBean autoPlanBean = planResultList.get(0);
				
				int rightNum = 0;				
				for (int i=0; i<csseResultList.size(); i++) {
					if (csseResultList.get(i).getCurrStatus() == 1) {
						rightNum++;
					}
				}
				autoPlanBean.setRightCaseNum(rightNum);
				
				createDetailReport(StaticParam.reportDir+ File.separator +detailName,StaticParam.reportImgDir,autoPlanBean);		
				logger.info("测试报告:" + detailName + "生成完毕!");
				reportBean.setErrorMsg(" ");
				sqlMapClient.insert("common_report.insertReportBGBean",reportBean);
				ArrayList<String> reportList = new ArrayList<String>();
				reportList.add(StaticParam.reportDir+ File.separator +detailName);
				if(StaticParam.sendMail.equals("Y")) {
					MailUtils.mailSend(reportList, "AIBGAT自动测试平台" + "TASK_ID:" + testPlanBean.getTaskId() + "测试报告");
					logger.info("TASK_ID:" + testPlanBean.getTaskId() + "的测试报告邮件发送成功!");
				}				
			}else {
				logger.error("无测试计划:" + testPlanBean.getPlanId() + "的测试结果,无法生成测试报告");
				reportBean.setErrorMsg("无测试计划:" + testPlanBean.getPlanId() + "的测试结果,无法生成测试报告");
				sqlMapClient.insert("common_report.insertReportBGBean",reportBean);
				return;
			}
		}
			
	}
	
		
	public void createDetailReport (String fileName,String imgDir,AutoPlanResultBGBean planResultBean) throws Exception {
		document = new Document(PageSize.A4, 40, 40, 40, 40);
		pdfWri = PdfWriter.getInstance(document, new FileOutputStream(fileName));
		bfChinese = BaseFont.createFont("STSong-Light","UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
		this.planResultBean = planResultBean;
		this.imgDir = imgDir;
		
		createCover();
		createReport();
	}
	
	private void createCover () throws Exception{
		
		document.open();
		PdfContentByte cb = pdfWri.getDirectContent();
		Image img = Image.getInstance(imgDir + File.separator + "AILK.jpg");
		img.scaleAbsoluteHeight(img.getHeight());
		img.scaleAbsoluteWidth(img.getWidth());
		
		cb.setLineWidth(0.1f);
		cb.moveTo(40f, 102f);
		cb.lineTo(40f, 812f);
		cb.lineTo(555f, 812f);
		cb.lineTo(555f, 102f);
		cb.lineTo(40f, 102f);
		cb.stroke();
		
		document.add(new Paragraph(" "));
		
		Table titleTable_1 = new Table(2);
		titleTable_1.setBorderWidthBottom(0f);
		titleTable_1.setBorderWidthTop(0f);
		titleTable_1.setBorderWidthLeft(0f);
		titleTable_1.setBorderWidthRight(0f);
		titleTable_1.setAlignment(Element.ALIGN_CENTER);
		titleTable_1.setWidth(100f);
		Cell title_1 = new Cell(new Chunk("AIBGAT项目管理文档    ",new Font(bfChinese,17)));
		title_1.setUseAscender(true);
		title_1.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
		title_1.setBorderWidth(0f);
		Cell title_2 = new Cell(img);
		title_2.setUseAscender(true);
		title_2.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
		title_2.setBorderWidth(0f);
		titleTable_1.addCell(title_1);
		titleTable_1.addCell(title_2);

		document.add(titleTable_1);
		
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		
		Paragraph title_3 = new Paragraph("AIBGAT自动测试平台",new Font(bfChinese,28));
		title_3.setAlignment(Element.ALIGN_CENTER);
		document.add(title_3);
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		
		LineSeparator line_1 = new LineSeparator();
		LineSeparator line_2 = new LineSeparator();
		line_1.setAlignment(Element.ALIGN_CENTER);
		line_2.setAlignment(Element.ALIGN_CENTER);
		line_1.setLineWidth(0.2f);
		line_2.setLineWidth(3f);
		line_1.setOffset(-20f);
		line_2.setOffset(-25f);
		line_1.setPercentage(95f);
		line_2.setPercentage(95f);
		
		document.add(line_1);
		document.add(line_2);
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		
		Paragraph title_4 = new Paragraph("自动测试报告",new Font(bfChinese,28));
		title_4.setAlignment(Element.ALIGN_CENTER);
		title_4.setExtraParagraphSpace(50f);
		document.add(title_4);
		
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		
		Table titleTable_2 = new Table(4,2);
		titleTable_2.setAlignment(Element.ALIGN_CENTER);
		titleTable_2.setWidth(100f);
		float[] t1_w = new float[]{20f,40f,20f,20f};
		titleTable_2.setWidths(t1_w);
		titleTable_2.setPadding(5f);
		titleTable_2.setBorderWidthLeft(0f);
		titleTable_2.setBorderWidthRight(0f);
		titleTable_2.setBorderWidthBottom(0.5f);
		titleTable_2.setBorderWidthTop(0.5f);
		
		
		Cell title_5 = new Cell(new Chunk("报告人",new Font(bfChinese,12)));
		title_5.setUseAscender(true);
		title_5.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_6 = new Cell(new Chunk("AIBGAT自动测试平台",new Font(bfChinese,12)));
		title_6.setUseAscender(true);
		title_6.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_7 = new Cell(new Chunk("报告时间",new Font(bfChinese,12)));
		title_7.setUseAscender(true);
		title_7.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_7.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_8 = new Cell(new Chunk((new Date(System.currentTimeMillis())).toString(),new Font(bfChinese,12)));
		title_8.setUseAscender(true);
		title_8.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_8.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_9 = new Cell(new Chunk("检验人",new Font(bfChinese,12)));
		title_9.setUseAscender(true);
		title_9.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_9.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_10 = new Cell(new Chunk("AIBGAT自动测试平台",new Font(bfChinese,12)));
		title_10.setUseAscender(true);
		title_10.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_10.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_11 = new Cell(new Chunk("检验时间",new Font(bfChinese,12)));
		title_11.setUseAscender(true);
		title_11.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_11.setVerticalAlignment(Element.ALIGN_MIDDLE);
		Cell title_12 = new Cell(new Chunk((new Date(System.currentTimeMillis())).toString(),new Font(bfChinese,12)));
		title_12.setUseAscender(true);
		title_12.setHorizontalAlignment(Element.ALIGN_CENTER);
		title_12.setVerticalAlignment(Element.ALIGN_MIDDLE);
		
		titleTable_2.addCell(title_5);
		titleTable_2.addCell(title_6);
		titleTable_2.addCell(title_7);
		titleTable_2.addCell(title_8);
		titleTable_2.addCell(title_9);
		titleTable_2.addCell(title_10);
		titleTable_2.addCell(title_11);
		titleTable_2.addCell(title_12);
		
		document.add(titleTable_2);
		
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		document.add(new Paragraph(" "));
		
		Paragraph title_13 = new Paragraph("亚信联创科技（中国）有限公司版权所有",new Font(bfChinese,12));
		title_13.setAlignment(Element.ALIGN_CENTER);
		Paragraph title_14 = new Paragraph("文档中的全部内容属亚信联创科技（中国）有限公司所有，",new Font(bfChinese,12));
		title_14.setAlignment(Element.ALIGN_CENTER);
		Paragraph title_15 = new Paragraph("未经允许，不可全部或部分发表、复制、使用于任何目的。",new Font(bfChinese,12));
		title_15.setAlignment(Element.ALIGN_CENTER);
		
		document.add(title_13);
		document.add(title_14);
		document.add(title_15);
		document.newPage();
		//document.close();
	}
	
	@SuppressWarnings({ "unchecked" })
	private void createReport() throws Exception {
		
		Font chapterFont = new Font(bfChinese,24);
		Font section_1Font = new Font(bfChinese,20);
		Font section_2Font = new Font(bfChinese,18);
		Font contentFont = new Font(bfChinese,12);
		Font tableFont = new Font(bfChinese,11);
		Font tableFont2 = new Font(bfChinese,8);
		
		Color headColor = new Color(192,192,192);
		Color wrongColor = new Color(255,255,0);
		
		Paragraph cTitle_1 = new Paragraph("测试计划执行概要",chapterFont);
		Chapter chapter_1 = new Chapter(cTitle_1,1);
		
		
		Paragraph sTitle_11 = new Paragraph("测试计划执行信息",section_1Font);
		Section section_11 = chapter_1.addSection(sTitle_11, 2);
		Paragraph pContent_1 = new Paragraph("      执行编号 : " + planResultBean.getTaskId(),contentFont);
		Paragraph pContent_2 = new Paragraph("      测试计划编号 : " + planResultBean.getTestPlanId(),contentFont);
		Paragraph pContent_3 = new Paragraph("      测试计划名称 : " + planResultBean.getTestPlanName(),contentFont);
		Paragraph pContent_4 = new Paragraph("      测试开始时间 : " + planResultBean.getStartTime(),contentFont);
		Paragraph pContent_5 = new Paragraph("      测试结束时间 : " + planResultBean.getEndTime(),contentFont);
		Paragraph pContent_6 = new Paragraph("      测试总耗时 : " + getTimeLength(planResultBean.getStartTime(),planResultBean.getEndTime()),contentFont);
		Paragraph pContent_7 = new Paragraph("      总用例数 : " + planResultBean.getTotalCaseNum(),contentFont);
		Paragraph pContent_8 = new Paragraph("      成功用例数 : " + planResultBean.getRightCaseNum(),contentFont);
		Paragraph pContent_9 = new Paragraph("      失败用例数 : " + (planResultBean.getTotalCaseNum()-planResultBean.getRightCaseNum()),contentFont);
		Paragraph pContent_10 = new Paragraph("      成功百分比 : " + (planResultBean.getRightCaseNum()*100/planResultBean.getTotalCaseNum()) + "%",contentFont);
		pContent_1.setSpacingBefore(10);
		pContent_2.setSpacingBefore(10);
		pContent_3.setSpacingBefore(10);
		pContent_4.setSpacingBefore(10);
		pContent_5.setSpacingBefore(10);
		pContent_6.setSpacingBefore(10);
		pContent_7.setSpacingBefore(10);
		pContent_8.setSpacingBefore(10);
		pContent_9.setSpacingBefore(10);
		pContent_10.setSpacingBefore(10);
		
		section_11.add(pContent_1);
		section_11.add(pContent_2);
		section_11.add(pContent_3);
		section_11.add(pContent_4);
		section_11.add(pContent_5);
		section_11.add(pContent_6);
		section_11.add(pContent_7);
		section_11.add(pContent_8);
		section_11.add(pContent_9);
		section_11.add(pContent_10);
		section_11.add(new Paragraph(" "));
		
		Paragraph sTitle_12 = new Paragraph("测试用例执行情况清单",section_1Font);
		Section section_12 = chapter_1.addSection(sTitle_12,2);
		
		Table sTable_12 = new Table(5);
		sTable_12.setWidth(100f);
		float[] t_12_w = new float[] {5,15,50,20,10};
		sTable_12.setWidths(t_12_w);
		sTable_12.setPadding(2f);
		sTable_12.setBorderWidth(0f);
		
		Cell sCellH_12_1 = new Cell(new Chunk("序号",tableFont));
		Cell sCellH_12_2 = new Cell(new Chunk("编号",tableFont));
		Cell sCellH_12_3 = new Cell(new Chunk("测试用例名称",tableFont));
		Cell sCellH_12_4 = new Cell(new Chunk("执行耗时",tableFont));
		Cell sCellH_12_5 = new Cell(new Chunk("结果",tableFont));
		
		sCellH_12_1.setHeader(true);
		sCellH_12_2.setHeader(true);
		sCellH_12_3.setHeader(true);
		sCellH_12_4.setHeader(true);
		sCellH_12_5.setHeader(true);
		
		sCellH_12_1.setBackgroundColor(headColor);
		sCellH_12_2.setBackgroundColor(headColor);
		sCellH_12_3.setBackgroundColor(headColor);
		sCellH_12_4.setBackgroundColor(headColor);
		sCellH_12_5.setBackgroundColor(headColor);
		
		sCellH_12_1.setUseAscender(true);
		sCellH_12_2.setUseAscender(true);
		sCellH_12_3.setUseAscender(true);
		sCellH_12_4.setUseAscender(true);
		sCellH_12_5.setUseAscender(true);
		
		sCellH_12_1.setHorizontalAlignment(Element.ALIGN_CENTER);
		sCellH_12_2.setHorizontalAlignment(Element.ALIGN_CENTER);
		sCellH_12_3.setHorizontalAlignment(Element.ALIGN_CENTER);
		sCellH_12_4.setHorizontalAlignment(Element.ALIGN_CENTER);
		sCellH_12_5.setHorizontalAlignment(Element.ALIGN_CENTER);
		
		sCellH_12_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
		sCellH_12_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
		sCellH_12_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
		sCellH_12_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
		sCellH_12_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
		
		
		sTable_12.addCell(sCellH_12_1);
		sTable_12.addCell(sCellH_12_2);
		sTable_12.addCell(sCellH_12_3);
		sTable_12.addCell(sCellH_12_4);
		sTable_12.addCell(sCellH_12_5);
		
		
		SqlMapClient sqlMapClient = (SqlMapClient)SpringContextUtil.getBean("sqlMapClient");
		AutoCaseResultBGBean caseResultBean = new AutoCaseResultBGBean();
		caseResultBean.setTaskId(planResultBean.getTaskId());
		ArrayList<AutoCaseResultBGBean> csseResultList = (ArrayList)sqlMapClient.queryForList("common_report.getCaseResultBGBeanByTaskId",caseResultBean);
		for (int i=0;i<csseResultList.size();i++) {
			
			AutoCaseResultBGBean bean = csseResultList.get(i);
			
			Cell sCellB12_1 = new Cell(new Chunk(""+(i+1),tableFont));
			Cell sCellB12_2 = new Cell(new Chunk(bean.getTestCaseId()+"",tableFont));
			Cell sCellB12_3 = new Cell(new Chunk(bean.getTestCaseName(),tableFont));
			Cell sCellB12_4 = new Cell(new Chunk(getTimeLength(bean.getStartTime(),bean.getEndTime()),tableFont));
			Cell sCellB12_5 = new Cell(new Chunk(getCaseStatus(bean.getCurrStatus()),tableFont));
			
			sCellB12_1.setUseAscender(true);
			sCellB12_2.setUseAscender(true);
			sCellB12_3.setUseAscender(true);
			sCellB12_4.setUseAscender(true);
			sCellB12_5.setUseAscender(true);
			
			sCellB12_1.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellB12_2.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellB12_4.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellB12_5.setHorizontalAlignment(Element.ALIGN_CENTER);
			
			sCellB12_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellB12_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellB12_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellB12_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellB12_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
			
			if (bean.getCurrStatus() != 1) {
				sCellB12_1.setBackgroundColor(wrongColor);
				sCellB12_2.setBackgroundColor(wrongColor);
				sCellB12_3.setBackgroundColor(wrongColor);
				sCellB12_4.setBackgroundColor(wrongColor);
				sCellB12_5.setBackgroundColor(wrongColor);
			}
			
			sTable_12.addCell(sCellB12_1);
			sTable_12.addCell(sCellB12_2);
			sTable_12.addCell(sCellB12_3);
			sTable_12.addCell(sCellB12_4);
			sTable_12.addCell(sCellB12_5);
		}
		
		section_12.add(sTable_12);
		
		document.add(chapter_1);
		
		Paragraph cTitle_2 = new Paragraph("测试用例执行信息",chapterFont);
		Chapter chapter_2 = new Chapter(cTitle_2,2);
		
		
		for (int i=0;i<csseResultList.size();i++) {
			AutoCaseResultBGBean caseBean = csseResultList.get(i);
			Paragraph sTitle_2 = new Paragraph(caseBean.getTestCaseName(),section_1Font);
			Section section_2 = chapter_2.addSection(sTitle_2, 2);
			
			AutoStepResultBGBean stepResultBg = new AutoStepResultBGBean();
			stepResultBg.setTaskId(caseBean.getTaskId());
			stepResultBg.setTestNo(caseBean.getTestNo());
			ArrayList<AutoStepResultBGBean> stepResultList = (ArrayList)sqlMapClient.queryForList("common_result.getStepResultBGBean",stepResultBg);
			
			int rithtNum = 0;			
			for(int n=0; n<stepResultList.size(); n++) {
				if(stepResultList.get(n).getIsRight().equals("Y")) {
					rithtNum++;
				}
			}
			caseBean.setRightStepNum(rithtNum);
			
			Paragraph sTitle_21 = new Paragraph("用例执行信息",section_2Font);
			Section section_21 = section_2.addSection(sTitle_21,3);
			
			Paragraph pContent_21 = new Paragraph("      用例编号: " + caseBean.getTestCaseId(),contentFont);
			Paragraph pContent_22 = new Paragraph("      用例名称: " + caseBean.getTestCaseName(),contentFont);
			Paragraph pContent_23 = new Paragraph("      测试开始时间: " + caseBean.getStartTime(),contentFont);
			Paragraph pContent_24 = new Paragraph("      测试结束时间: " + caseBean.getEndTime(),contentFont);
			Paragraph pContent_25 = new Paragraph("      测试总耗时: " + getTimeLength(caseBean.getStartTime(),caseBean.getEndTime()),contentFont);
			Paragraph pContent_26 = new Paragraph("      成功步骤数: " + caseBean.getRightStepNum(),contentFont);
			Paragraph pContent_27 = new Paragraph("      失败步骤数: " + (caseBean.getTotalStepNum()-caseBean.getRightStepNum()),contentFont);
			Paragraph pContent_28 = new Paragraph("      步骤成功百分比: " + (caseBean.getRightStepNum()*100/caseBean.getTotalStepNum()) + "%",contentFont);
			
			pContent_21.setSpacingBefore(10);
			pContent_22.setSpacingBefore(10);
			pContent_23.setSpacingBefore(10);
			pContent_24.setSpacingBefore(10);
			pContent_25.setSpacingBefore(10);
			pContent_26.setSpacingBefore(10);
			pContent_27.setSpacingBefore(10);
			pContent_28.setSpacingBefore(10);
			
			section_21.add(pContent_21);
			section_21.add(pContent_22);
			section_21.add(pContent_23);
			section_21.add(pContent_24);
			section_21.add(pContent_25);
			section_21.add(pContent_26);
			section_21.add(pContent_27);
			section_21.add(pContent_28);
			section_21.add(new Paragraph(" "));
			
			Paragraph sTitle_22 = new Paragraph("测试步骤执行结果明细",section_2Font);
			Section section_22 = section_2.addSection(sTitle_22,3); 
			
			Table sTable_22 = new Table(5);
			sTable_22.setWidth(100f);
			float[] t_22_w = new float[] {5,15,50,20,10};
			sTable_22.setWidths(t_22_w);
			sTable_22.setPadding(2f);
			sTable_22.setBorderWidth(0f);
			
			Cell sCellH_22_1 = new Cell(new Chunk("序号",tableFont));
			Cell sCellH_22_2 = new Cell(new Chunk("编号",tableFont));
			Cell sCellH_22_3 = new Cell(new Chunk("测试步骤名称",tableFont));
			Cell sCellH_22_4 = new Cell(new Chunk("执行耗时",tableFont));
			Cell sCellH_22_5 = new Cell(new Chunk("结果",tableFont));
			
			sCellH_22_1.setHeader(true);
			sCellH_22_2.setHeader(true);
			sCellH_22_3.setHeader(true);
			sCellH_22_4.setHeader(true);
			sCellH_22_5.setHeader(true);
			
			sCellH_22_1.setBackgroundColor(headColor);
			sCellH_22_2.setBackgroundColor(headColor);
			sCellH_22_3.setBackgroundColor(headColor);
			sCellH_22_4.setBackgroundColor(headColor);
			sCellH_22_5.setBackgroundColor(headColor);
			
			sCellH_22_1.setUseAscender(true);
			sCellH_22_2.setUseAscender(true);
			sCellH_22_3.setUseAscender(true);
			sCellH_22_4.setUseAscender(true);
			sCellH_22_5.setUseAscender(true);
			
			sCellH_22_1.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_22_2.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_22_3.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_22_4.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_22_5.setHorizontalAlignment(Element.ALIGN_CENTER);
			
			sCellH_22_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_22_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_22_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_22_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_22_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
			
			
			sTable_22.addCell(sCellH_22_1);
			sTable_22.addCell(sCellH_22_2);
			sTable_22.addCell(sCellH_22_3);
			sTable_22.addCell(sCellH_22_4);
			sTable_22.addCell(sCellH_22_5);
			
			for (int j=0;j<stepResultList.size();j++) {
				
				AutoStepResultBGBean bean = stepResultList.get(j);

				Cell sCellB22_1 = new Cell(new Chunk(""+(j+1),tableFont));
				Cell sCellB22_2 = new Cell(new Chunk(bean.getSeqId()+"",tableFont));
				Cell sCellB22_3 = new Cell(new Chunk(bean.getStepName(),tableFont));
				Cell sCellB22_4 = new Cell(new Chunk(getTimeLength(bean.getStartTime(),bean.getEndTime()),tableFont));
				Cell sCellB22_5 = new Cell(new Chunk(getStepStatus(bean.getIsRight()),tableFont));
				
				sCellB22_1.setUseAscender(true);
				sCellB22_2.setUseAscender(true);
				sCellB22_3.setUseAscender(true);
				sCellB22_4.setUseAscender(true);
				sCellB22_5.setUseAscender(true);
				
				sCellB22_1.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB22_2.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB22_4.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB22_5.setHorizontalAlignment(Element.ALIGN_CENTER);
				
				sCellB22_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB22_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB22_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB22_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB22_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
				
				if (!bean.getIsRight().equals("Y")) {
					sCellB22_1.setBackgroundColor(wrongColor);
					sCellB22_2.setBackgroundColor(wrongColor);
					sCellB22_3.setBackgroundColor(wrongColor);
					sCellB22_4.setBackgroundColor(wrongColor);
					sCellB22_5.setBackgroundColor(wrongColor);
				}
				
				sTable_22.addCell(sCellB22_1);
				sTable_22.addCell(sCellB22_2);
				sTable_22.addCell(sCellB22_3);
				sTable_22.addCell(sCellB22_4);
				sTable_22.addCell(sCellB22_5);
			}
			
			section_22.add(sTable_22);
			section_22.add(new Paragraph(" "));
			
			Paragraph sTitle_23 = new Paragraph("数据准备步骤执行明细",section_2Font);
			Section section_23 = section_2.addSection(sTitle_23,3); 
			
			Table sTable_23 = new Table(6);
			sTable_23.setWidth(100f);
			float[] t_23_w = new float[] {17,35,15,15,10,8};
			sTable_23.setWidths(t_23_w);
			sTable_23.setPadding(2f);
			sTable_23.setBorderWidth(0f);
			
			Cell sCellH_23_1 = new Cell(new Chunk("测试步骤名称",tableFont));
			Cell sCellH_23_2 = new Cell(new Chunk("操作指令",tableFont));
			Cell sCellH_23_3 = new Cell(new Chunk("操作结果期望值",tableFont));
			Cell sCellH_23_4 = new Cell(new Chunk("操作结果实际值",tableFont));
			Cell sCellH_23_5 = new Cell(new Chunk("操作时间",tableFont));
			Cell sCellH_23_6 = new Cell(new Chunk("结果",tableFont));
			
			sCellH_23_1.setHeader(true);
			sCellH_23_2.setHeader(true);
			sCellH_23_3.setHeader(true);
			sCellH_23_4.setHeader(true);
			sCellH_23_5.setHeader(true);
			sCellH_23_6.setHeader(true);
			
			sCellH_23_1.setBackgroundColor(headColor);
			sCellH_23_2.setBackgroundColor(headColor);
			sCellH_23_3.setBackgroundColor(headColor);
			sCellH_23_4.setBackgroundColor(headColor);
			sCellH_23_5.setBackgroundColor(headColor);
			sCellH_23_6.setBackgroundColor(headColor);
			
			sCellH_23_1.setUseAscender(true);
			sCellH_23_2.setUseAscender(true);
			sCellH_23_3.setUseAscender(true);
			sCellH_23_4.setUseAscender(true);
			sCellH_23_5.setUseAscender(true);
			sCellH_23_6.setUseAscender(true);
			
			sCellH_23_1.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_23_2.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_23_3.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_23_4.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_23_5.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_23_6.setHorizontalAlignment(Element.ALIGN_CENTER);
			
			sCellH_23_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_23_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_23_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_23_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_23_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_23_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
			
			
			sTable_23.addCell(sCellH_23_1);
			sTable_23.addCell(sCellH_23_2);
			sTable_23.addCell(sCellH_23_3);
			sTable_23.addCell(sCellH_23_4);
			sTable_23.addCell(sCellH_23_5);
			sTable_23.addCell(sCellH_23_6);
			
			
			AutoStepResultDetailBGBean stepResultDetailBG = new AutoStepResultDetailBGBean();
			stepResultDetailBG.setTaskId(caseBean.getTaskId());
			stepResultDetailBG.setTestNo(caseBean.getTestNo());
			stepResultDetailBG.setType("1");
			ArrayList<AutoStepResultDetailBGBean> stepResultDetailList = (ArrayList)sqlMapClient.queryForList("common_report.getStepResultDetailBGBeanByTaskIdTestNo",stepResultDetailBG);
			
			for (int j=0;j<stepResultDetailList.size();j++) {
				
				AutoStepResultDetailBGBean bean = stepResultDetailList.get(j);
				
				if (bean.getStatus().equals("1")) {
					bean.setStatus("正确");
				}
				else if (bean.getStatus().equals("2")) {
					bean.setStatus("错误");
				}
				else if (bean.getStatus().equals("3")) {
					bean.setStatus("异常");
				}
				else {
					bean.setStatus("状态非法");
				}
				
				Cell sCellB23_1 = new Cell(new Chunk(bean.getStepName(),tableFont2));
				Cell sCellB23_2 = new Cell(new Chunk(bean.getHandleData(),tableFont2));
				Cell sCellB23_3 = new Cell(new Chunk(bean.getExpectData(),tableFont2));
				Cell sCellB23_4 = new Cell(new Chunk(bean.getRealData(),tableFont2));
				Cell sCellB23_5 = new Cell(new Chunk(bean.getCreateTime(),tableFont2));
				Cell sCellB23_6 = new Cell(new Chunk(bean.getStatus(),tableFont2));
				
				sCellB23_1.setUseAscender(true);
				sCellB23_2.setUseAscender(true);
				sCellB23_3.setUseAscender(true);
				sCellB23_4.setUseAscender(true);
				sCellB23_5.setUseAscender(true);
				sCellB23_6.setUseAscender(true);
				
				sCellB23_5.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB23_6.setHorizontalAlignment(Element.ALIGN_CENTER);
				
				sCellB23_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB23_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB23_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB23_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB23_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB23_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
				
				if (!bean.getStatus().equals("正确")) {
					sCellB23_1.setBackgroundColor(wrongColor);
					sCellB23_2.setBackgroundColor(wrongColor);
					sCellB23_3.setBackgroundColor(wrongColor);
					sCellB23_4.setBackgroundColor(wrongColor);
					sCellB23_5.setBackgroundColor(wrongColor);
					sCellB23_6.setBackgroundColor(wrongColor);
				}
				
				sTable_23.addCell(sCellB23_1);
				sTable_23.addCell(sCellB23_2);
				sTable_23.addCell(sCellB23_3);
				sTable_23.addCell(sCellB23_4);
				sTable_23.addCell(sCellB23_5);
				sTable_23.addCell(sCellB23_6);
			}
			
			section_23.add(sTable_23);
			section_23.add(new Paragraph(" "));
			
			Paragraph sTitle_24 = new Paragraph("程序调用步骤执行明细",section_2Font);
			Section section_24 = section_2.addSection(sTitle_24,3); 
			
			Table sTable_24 = new Table(6);
			sTable_24.setWidth(100f);
			float[] t_24_w = new float[] {17,35,15,15,10,8};
			sTable_24.setWidths(t_24_w);
			sTable_24.setPadding(2f);
			sTable_24.setBorderWidth(0f);
			
			Cell sCellH_24_1 = new Cell(new Chunk("测试步骤名称",tableFont));
			Cell sCellH_24_2 = new Cell(new Chunk("操作指令",tableFont));
			Cell sCellH_24_3 = new Cell(new Chunk("操作结果期望值",tableFont));
			Cell sCellH_24_4 = new Cell(new Chunk("操作结果实际值",tableFont));
			Cell sCellH_24_5 = new Cell(new Chunk("操作时间",tableFont));
			Cell sCellH_24_6 = new Cell(new Chunk("结果",tableFont));
			
			sCellH_24_1.setHeader(true);
			sCellH_24_2.setHeader(true);
			sCellH_24_3.setHeader(true);
			sCellH_24_4.setHeader(true);
			sCellH_24_5.setHeader(true);
			sCellH_24_6.setHeader(true);
			
			sCellH_24_1.setBackgroundColor(headColor);
			sCellH_24_2.setBackgroundColor(headColor);
			sCellH_24_3.setBackgroundColor(headColor);
			sCellH_24_4.setBackgroundColor(headColor);
			sCellH_24_5.setBackgroundColor(headColor);
			sCellH_24_6.setBackgroundColor(headColor);
			
			sCellH_24_1.setUseAscender(true);
			sCellH_24_2.setUseAscender(true);
			sCellH_24_3.setUseAscender(true);
			sCellH_24_4.setUseAscender(true);
			sCellH_24_5.setUseAscender(true);
			sCellH_24_6.setUseAscender(true);
			
			sCellH_24_1.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_24_2.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_24_3.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_24_4.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_24_5.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_24_6.setHorizontalAlignment(Element.ALIGN_CENTER);
			
			sCellH_24_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_24_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_24_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_24_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_24_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_24_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
			
			
			sTable_24.addCell(sCellH_24_1);
			sTable_24.addCell(sCellH_24_2);
			sTable_24.addCell(sCellH_24_3);
			sTable_24.addCell(sCellH_24_4);
			sTable_24.addCell(sCellH_24_5);
			sTable_24.addCell(sCellH_24_6);
			
			
			stepResultDetailBG = new AutoStepResultDetailBGBean();
			stepResultDetailBG.setTaskId(caseBean.getTaskId());
			stepResultDetailBG.setTestNo(caseBean.getTestNo());
			stepResultDetailBG.setType("2");
			ArrayList<AutoStepResultDetailBGBean> stepResultDetailAppRunList = (ArrayList)sqlMapClient.queryForList("common_report.getStepResultDetailBGBeanByTaskIdTestNo",stepResultDetailBG);
			
			for (int j=0;j<stepResultDetailAppRunList.size();j++) {
				
				AutoStepResultDetailBGBean bean = stepResultDetailAppRunList.get(j);
				
				if (bean.getStatus().equals("1")) {
					bean.setStatus("正确");
				}
				else if (bean.getStatus().equals("2")) {
					bean.setStatus("错误");
				}
				else if (bean.getStatus().equals("3")) {
					bean.setStatus("异常");
				}
				else {
					bean.setStatus("状态非法");
				}
				
				Cell sCellB24_1 = new Cell(new Chunk(bean.getStepName(),tableFont2));
				Cell sCellB24_2 = new Cell(new Chunk(bean.getHandleData(),tableFont2));
				Cell sCellB24_3 = new Cell(new Chunk(bean.getExpectData(),tableFont2));
				Cell sCellB24_4 = new Cell(new Chunk(bean.getRealData(),tableFont2));
				Cell sCellB24_5 = new Cell(new Chunk(bean.getCreateTime(),tableFont2));
				Cell sCellB24_6 = new Cell(new Chunk(bean.getStatus(),tableFont2));
				
				sCellB24_1.setUseAscender(true);
				sCellB24_2.setUseAscender(true);
				sCellB24_3.setUseAscender(true);
				sCellB24_4.setUseAscender(true);
				sCellB24_5.setUseAscender(true);
				sCellB24_6.setUseAscender(true);
				
				sCellB24_5.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB24_6.setHorizontalAlignment(Element.ALIGN_CENTER);
				
				sCellB24_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB24_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB24_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB24_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB24_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB24_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
				
				if (!bean.getStatus().equals("正确")) {
					sCellB24_1.setBackgroundColor(wrongColor);
					sCellB24_2.setBackgroundColor(wrongColor);
					sCellB24_3.setBackgroundColor(wrongColor);
					sCellB24_4.setBackgroundColor(wrongColor);
					sCellB24_5.setBackgroundColor(wrongColor);
					sCellB24_6.setBackgroundColor(wrongColor);
				}
				
				sTable_24.addCell(sCellB24_1);
				sTable_24.addCell(sCellB24_2);
				sTable_24.addCell(sCellB24_3);
				sTable_24.addCell(sCellB24_4);
				sTable_24.addCell(sCellB24_5);
				sTable_24.addCell(sCellB24_6);
			}
			
			section_24.add(sTable_24);
			section_24.add(new Paragraph(" "));
			
			Paragraph sTitle_25 = new Paragraph("结果比对步骤执行明细",section_2Font);
			Section section_25 = section_2.addSection(sTitle_25,3); 
			
			Table sTable_25 = new Table(6);
			sTable_25.setWidth(100f);
			float[] t_25_w = new float[] {17,35,15,15,10,8};
			sTable_25.setWidths(t_25_w);
			sTable_25.setPadding(2f);
			sTable_25.setBorderWidth(0f);
			
			Cell sCellH_25_1 = new Cell(new Chunk("测试步骤名称",tableFont));
			Cell sCellH_25_2 = new Cell(new Chunk("操作指令",tableFont));
			Cell sCellH_25_3 = new Cell(new Chunk("操作结果期望值",tableFont));
			Cell sCellH_25_4 = new Cell(new Chunk("操作结果实际值",tableFont));
			Cell sCellH_25_5 = new Cell(new Chunk("操作时间",tableFont));
			Cell sCellH_25_6 = new Cell(new Chunk("结果",tableFont));
			
			sCellH_25_1.setHeader(true);
			sCellH_25_2.setHeader(true);
			sCellH_25_3.setHeader(true);
			sCellH_25_4.setHeader(true);
			sCellH_25_5.setHeader(true);
			sCellH_25_6.setHeader(true);
			
			sCellH_25_1.setBackgroundColor(headColor);
			sCellH_25_2.setBackgroundColor(headColor);
			sCellH_25_3.setBackgroundColor(headColor);
			sCellH_25_4.setBackgroundColor(headColor);
			sCellH_25_5.setBackgroundColor(headColor);
			sCellH_25_6.setBackgroundColor(headColor);
			
			sCellH_25_1.setUseAscender(true);
			sCellH_25_2.setUseAscender(true);
			sCellH_25_3.setUseAscender(true);
			sCellH_25_4.setUseAscender(true);
			sCellH_25_5.setUseAscender(true);
			sCellH_25_6.setUseAscender(true);
			
			sCellH_25_1.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_25_2.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_25_3.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_25_4.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_25_5.setHorizontalAlignment(Element.ALIGN_CENTER);
			sCellH_25_6.setHorizontalAlignment(Element.ALIGN_CENTER);
			
			sCellH_25_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_25_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_25_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_25_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_25_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
			sCellH_25_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
			
			
			sTable_25.addCell(sCellH_25_1);
			sTable_25.addCell(sCellH_25_2);
			sTable_25.addCell(sCellH_25_3);
			sTable_25.addCell(sCellH_25_4);
			sTable_25.addCell(sCellH_25_5);
			sTable_25.addCell(sCellH_25_6);
			
			
			stepResultDetailBG = new AutoStepResultDetailBGBean();
			stepResultDetailBG.setTaskId(caseBean.getTaskId());
			stepResultDetailBG.setTestNo(caseBean.getTestNo());
			stepResultDetailBG.setType("3");
			ArrayList<AutoStepResultDetailBGBean> stepResultDetailCompareList = (ArrayList)sqlMapClient.queryForList("common_report.getStepResultDetailBGBeanByTaskIdTestNo",stepResultDetailBG);
			for (int j=0;j<stepResultDetailCompareList.size();j++) {
				
				AutoStepResultDetailBGBean bean = stepResultDetailCompareList.get(j);
				
				if (bean.getStatus().equals("1")) {
					bean.setStatus("正确");
				}
				else if (bean.getStatus().equals("2")) {
					bean.setStatus("错误");
				}
				else if (bean.getStatus().equals("3")) {
					bean.setStatus("异常");
				}
				else {
					bean.setStatus("状态非法");
				}
				
				Cell sCellB25_1 = new Cell(new Chunk(bean.getStepName(),tableFont2));
				Cell sCellB25_2 = new Cell(new Chunk(bean.getHandleData(),tableFont2));
				Cell sCellB25_3 = new Cell(new Chunk(bean.getExpectData(),tableFont2));
				Cell sCellB25_4 = new Cell(new Chunk(bean.getRealData(),tableFont2));
				Cell sCellB25_5 = new Cell(new Chunk(bean.getCreateTime(),tableFont2));
				Cell sCellB25_6 = new Cell(new Chunk(bean.getStatus(),tableFont2));
				
				sCellB25_1.setUseAscender(true);
				sCellB25_2.setUseAscender(true);
				sCellB25_3.setUseAscender(true);
				sCellB25_4.setUseAscender(true);
				sCellB25_5.setUseAscender(true);
				sCellB25_6.setUseAscender(true);
				
				sCellB25_5.setHorizontalAlignment(Element.ALIGN_CENTER);
				sCellB25_6.setHorizontalAlignment(Element.ALIGN_CENTER);
				
				sCellB25_1.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB25_2.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB25_3.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB25_4.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB25_5.setVerticalAlignment(Element.ALIGN_MIDDLE);
				sCellB25_6.setVerticalAlignment(Element.ALIGN_MIDDLE);
				
				if (!bean.getStatus().equals("正确")) {
					sCellB25_1.setBackgroundColor(wrongColor);
					sCellB25_2.setBackgroundColor(wrongColor);
					sCellB25_3.setBackgroundColor(wrongColor);
					sCellB25_4.setBackgroundColor(wrongColor);
					sCellB25_5.setBackgroundColor(wrongColor);
					sCellB25_6.setBackgroundColor(wrongColor);
				}
				
				sTable_25.addCell(sCellB25_1);
				sTable_25.addCell(sCellB25_2);
				sTable_25.addCell(sCellB25_3);
				sTable_25.addCell(sCellB25_4);
				sTable_25.addCell(sCellB25_5);
				sTable_25.addCell(sCellB25_6);
			}
			
			section_25.add(sTable_25);
			section_25.add(new Paragraph(" "));
		}
		document.add(chapter_2);
		document.close();	
	}
	
	@SuppressWarnings("unused")
	private String getTimeLength(Date d1,Date d2) {
		
		long ld1 = d2.getTime()-d1.getTime();
		ld1 /=1000;
		String hour = Long.toString(ld1/3600);
		String min = Long.toString((ld1%3600)/60);
		String sec = Long.toString(ld1%3600%60);
		return hour + " 小时 " + min + " 分钟 " + sec + " 秒";
	}
	@SuppressWarnings("unused")
	private String getTimeLength(long d1,long d2) {
		
		long ld1 = d2-d1;
		ld1 /=1000;
		String hour = Long.toString(ld1/3600);
		String min = Long.toString((ld1%3600)/60);
		String sec = Long.toString(ld1%3600%60);
		return hour + " 小时 " + min + " 分钟 " + sec + " 秒";
	}
	
	private String getTimeLength (String d1,String d2) throws Exception {
		SimpleDateFormat sDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		long ld1 = sDF.parse(d2).getTime() - sDF.parse(d1).getTime();
		ld1 /=1000;
		String hour = Long.toString(ld1/3600);
		String min = Long.toString((ld1%3600)/60);
		String sec = Long.toString(ld1%3600%60);
		return hour + " 小时 " + min + " 分钟 " + sec + " 秒";
	}
	@SuppressWarnings("unused")
	private String dateFormat (Date d1) throws Exception {
		
		SimpleDateFormat sDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Timestamp t1 = new Timestamp(d1.getTime());
		return sDF.format(d1);
	}
	@SuppressWarnings("unused")
	private String dateFormat (long d1) throws Exception {
		
		SimpleDateFormat sDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Timestamp t1 = new Timestamp(d1);
		return sDF.format(t1);
	}
	
	private String getCaseStatus (int status) {
		
		if (status == 1) {
			return "通过";
		}
		else {
			return "未通过";
		}
	}
	
	private String getStepStatus (String status) {
		
		if (status.equals("Y")) {
			return "通过";
		}
		else {
			return "未通过";
		}
	}
}
